import request from "@/utils/request";

export function login(data) {
  return request({
    url: "/api/v1/auth/manager_login", //需要把接口换成自己服务器的接口
    method: "post",
    data,
  });
}

export function getInfo() {
  return request({
    url: "/api/v1/users/manager_info", //需要把接口换成自己服务器的接口
    method: "get",
  });
}

export function logout() {
  return request({
    url: "/vue-element-admin/user/logout",
    method: "post",
  });
}

// 获取所有的用户信息
export function getUsers(per, page) {
  return request({
    url: "/api/v1/admin/users", //需要把接口换成自己服务器的接口
    method: "get",
    params: {
      per,
      page,
    },
  });
}

//获取用户收货地址
export function getAddress(id) {
  return request({
    url: "/api/v1/admin/addresses/" + id,
    method: "get",
  });
}

//修改用户信息
export function xiugaiUser(id, data) {
  return request({
    url: "/api/v1/admin/users/" + id,
    method: "put",
    data,
  });
}

//删除用户信息
export function deleteUser(id) {
  return request({
    url: "/api/v1/admin/users/" + id,
    method: "delete",
  });
}
